//
//  AcvQequestView.m
//  ZiJinLian
//
//  Created by 震霄 张 on 2018/4/6.
//  Copyright © 2018年 lzy. All rights reserved.
//

#import "AcvQequestView.h"

@interface AcvQequestView()
@property (weak, nonatomic) IBOutlet UIButton *cancelBtn;
@property (weak, nonatomic) IBOutlet UIButton *sureBtn;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *widDistance;
@property (weak, nonatomic) IBOutlet UITextField *nameTF;
@property (weak, nonatomic) IBOutlet UITextView *desTV;
@property (weak, nonatomic) IBOutlet UIButton *selectBTN;

@end

@implementation AcvQequestView
+(instancetype)acvQequestView
{
	return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].lastObject;

}
-(void)awakeFromNib
{
	[super awakeFromNib];
	self.autoresizingMask = UIViewAutoresizingNone;
	self.widDistance.constant = 149;
	[self.cancelBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:UIControlStateNormal];
	[self.sureBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:UIControlStateNormal];
	
	self.desTV.layer.borderColor = [[UIColor colorWithRed:215.0 / 255.0 green:215.0 / 255.0 blue:215.0 / 255.0 alpha:1] CGColor];
	self.desTV.layer.borderWidth = 0.6f;
	self.desTV.layer.cornerRadius = 6.0f;
}
- (IBAction)cancelBtnClick:(id)sender {
	if ([self.delegate respondsToSelector:@selector(cancelQequest)]) {
		[self.delegate cancelQequest];
	}
}

- (IBAction)sureBtnClick:(id)sender {
	if ([self.delegate respondsToSelector:@selector(makeSureQequest:info:isOPen:)]) {
		[self.delegate makeSureQequest:self.nameTF.text info:self.desTV.text isOPen:self.selectBTN.selected];
	}
}
- (IBAction)btnCLick:(id)sender {
	BOOL tmp = self.selectBTN.selected;
	self.selectBTN.selected = !tmp;
}
-(void)setName:(NSString *)name
{
	_name = name;
	self.nameTF.text = name.length>0?name:@"";
}
-(void)setDes:(NSString *)des
{
	_des = des;
	self.desTV.text = des.length>0?des:@"";
}
-(void)setOpen:(BOOL)open
{
	_open = open;
	self.selectBTN.selected = open;
}
@end
